jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Events/API/jQuery - Sample Code

die([type], [fn])


            
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="/jquery/js/jquery.js"></script>
  
  <script>
  $(document).ready(function(){
    
function aClick() {
  $("div").show().fadeOut("slow");
}
$("#bind").click(function () {
  $("#theone").live("click", aClick)
              .text("クリック!");
});
$("#unbind").click(function () {
  $("#theone").die("click", aClick)
              .text("何もしない...");
});

  });
  </script>
  <style>
  button { margin:5px; }
  button#theone { color:red; background:yellow; }
  </style>
</head>
<body>
<button id="theone">何もしない...</button>
<button id="bind">live</button>
<button id="unbind">die</button>
<div style="display:none;">Click!</div>
</body>
</html>
            
          
[実行結果]
[die([type], [fn]) の説明へ]